package cn.com.enboga.musicbox.utils
{
	public class OtherUtils
	{
		public function OtherUtils()
		{
		}
		
		/** 将毫秒转换成以下格式 01:01:01 */
		public static function toTime(num:uint):String{
			var h:uint = 0;
			var m:uint = 0;
			var s:uint = 0;
			var n:uint = num;
			var timeStr:String = "";
			
			if(num > 3600000){
            	h = n / 3600000;
            	n %= 3600000;
            }
            
            if(num > 60000){
            	m = n / 60000;
            	n %= 60000;
            }
            
            if(num > 1000){
            	s = n / 1000;
            }
            
            if(h < 10){
            	timeStr += "0";
            }                
            timeStr += h + ":";                
            if(m < 10){
            	timeStr += "0";
            }
			timeStr += m + ":";
            if(s < 10){
            	timeStr += "0";
            }
          	timeStr += s;
            
            return timeStr;
		}
		
		/** 获得某个字符后的字符串 */
		public static function getLastString(str:String, s:String):String{
			var index:int = str.lastIndexOf(s);	
			var kzmStr:String = str.substr(index+1, str.length-1);
            
            return kzmStr;
		}
		
		/** 将Stirng 转换成 boolean */
		public static function stringToBoolean(str:String):Boolean{
			var trueOrFalse:Boolean = false;
			if(str != null && str.toLocaleUpperCase() == "TRUE"){
				trueOrFalse = true;
			}
            
            return trueOrFalse;
		}
	}
}